package com.zhanqiao.service;

import com.sun.xml.internal.bind.v2.model.core.ID;
import com.zhanqiao.Dao.DraftDao;
import com.zhanqiao.domain.ArticleBean;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class UpdateDraftService implements ArticleService {
    @Override
    public List<ArticleBean> articleService() {
        return null;
    }
    public int articleService(String id,String content,String publishdate,String title){
        DraftDao draftDao = new DraftDao();
        int uid = Integer.parseInt(id);
        DateFormat df = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss");
        try {
            Date publish = df.parse(publishdate);
            int i = draftDao.updateArticle(uid, publish, title, content);
            return i;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return 0;

    }
}
